package HeChuyenGia;

import java.sql.Connection;
import KetNoiCSDL.KetNoiCSDL;
import com.sun.rowset.JdbcRowSetImpl;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.table.DefaultTableModel;
public class GiaoDienChinh extends javax.swing.JFrame {
    Connection DoiTuongKetNoi = null;
    KetNoiCSDL KetNoi = null;
    
    DefaultTableModel DinhDangTable1;
    DefaultTableModel DinhDangTable2;
    DefaultTableModel DinhDangTable3;
    DefaultTableModel DinhDangTable4;
    DefaultTableModel DinhDangTable5;
    JdbcRowSetImpl Nhay = null;
    
    public String MaBenh;
    public String MaCauHoi;
    public String MaThuocChon;
    public String MaBenhChuaTri;
    public String TenBenhChuaTri;
    public String MaCauHoiCanThiet;
    public String CauHoiCanThiet;
    
    public GiaoDienChinh() {
        initComponents();
        
        DinhDangTable1 = (DefaultTableModel) tbTenBenh.getModel();
        DinhDangTable2 = (DefaultTableModel) tbTenThuoc.getModel();
        DinhDangTable3 = (DefaultTableModel) tbTenBenh_Thuoc.getModel();
        DinhDangTable4 = (DefaultTableModel) tbCauHoi.getModel();
        DinhDangTable5 = (DefaultTableModel) tbbCauHoi.getModel();
        
        this.setLocationRelativeTo(null);
        
        SelectTenBenh();
        
        HoiDap.setVisible(true);
        HDSD.setVisible(false);
        
        btTaiSao.setEnabled(false);
        
        tpChuyenGia.setVisible(false);
    }
    
    public void SelectTenBenh()
    {
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        while(DinhDangTable1.getRowCount()>0)
                DinhDangTable1.removeRow(0);
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT * FROM BenhTimMach;");
                while(Luu.next())
                {
                    Vector Point = new Vector();
                    Point.add(Luu.getString(1));
                    Point.add(Luu.getString(2));
                    DinhDangTable1.addRow(Point);
                }
                tbTenBenh.setModel(DinhDangTable1);
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            }
    };
    
    public void SelectTenBenh_Thuoc()
    {
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        while(DinhDangTable3.getRowCount()>0)
                DinhDangTable3.removeRow(0);
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT * FROM BenhTimMach;");
                while(Luu.next())
                {
                    Vector Point = new Vector();
                    Point.add(Luu.getString(1));
                    Point.add(Luu.getString(2));
                    DinhDangTable3.addRow(Point);
                }
                tbTenBenh_Thuoc.setModel(DinhDangTable3);
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            }
    };
    
    public void SelectDanhSachCauHoi()
    {
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        while(DinhDangTable4.getRowCount()>0)
                DinhDangTable4.removeRow(0);
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT DISTINCT MaCauHoi, CauHoi FROM DanhSachCauHoi ORDER BY MaCauHoi ASC;");
                while(Luu.next())
                {
                    Vector Point = new Vector();
                    Point.add(Luu.getString(1));
                    Point.add(Luu.getString(2));
                    DinhDangTable4.addRow(Point);
                }
                tbCauHoi.setModel(DinhDangTable4);
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            }
    };
    
    public void SelectDanhSachCauHoi2()
    {
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        while(DinhDangTable5.getRowCount()>0)
                DinhDangTable5.removeRow(0);
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT DISTINCT MaCauHoi, CauHoi FROM DanhSachCauHoi ORDER BY MaCauHoi DESC;");
                while(Luu.next())
                {
                    Vector Point = new Vector();
                    Point.add(Luu.getString(1));
                    Point.add(Luu.getString(2));
                    DinhDangTable5.addRow(Point);
                }
                tbbCauHoi.setModel(DinhDangTable5);
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            }
    };
    
    public void SelectTenThuoc(String a)
    {
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        while(DinhDangTable2.getRowCount()>0)
                DinhDangTable2.removeRow(0);
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT MaThuoc, TenThuoc FROM Thuoc WHERE MaThuoc IN (SELECT MaThuoc FROM CauHoiTungThuoc \n" +
"WHERE MaThuoc IN (SELECT MaThuoc FROM DungThuoc WHERE MaBenh = '"+ a +"'));");
                while(Luu.next())
                {
                    Vector Point = new Vector();
                    Point.add(Luu.getString(1));
                    Point.add(Luu.getString(2));
                    DinhDangTable2.addRow(Point);
                }
                tbTenThuoc.setModel(DinhDangTable2);
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            }
    };
    
    public void ThuocChuaBenh()
    {
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        while(DinhDangTable2.getRowCount()>0)
                DinhDangTable2.removeRow(0);
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT * FROM Thuoc where MaThuoc IN (SELECT DISTINCT MaThuoc FROM CauHoiTungThuoc WHERE XacNhan = 2 AND MaThuoc	\n" +
"NOT IN (SELECT MaThuoc FROM CauHoiTungThuoc WHERE XacNhan = 1) \n" +
"AND MaThuoc IN (SELECT MaThuoc FROM DungThuoc WHERE MaBenh = '"+ MaBenh +"'))");
                while(Luu.next())
                {
                    Vector Point = new Vector();
                    Point.add(Luu.getString(1));
                    Point.add(Luu.getString(2));
                    DinhDangTable2.addRow(Point);
                }
                tbTenThuoc.setModel(DinhDangTable2);
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            }
    }
    public void ThuocUuTien()
    {
        MaThuocChon = tbTenThuoc.getValueAt(0, 0).toString();
        lbTenThuoc.setText(tbTenThuoc.getValueAt(0, 1).toString());
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT LieuDung FROM Thuoc WHERE MaThuoc = '"+MaThuocChon+"'");
                if(Luu.next())
                {
                    lbLieuDung.setText(Luu.getString("LieuDung"));
                }
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            }
    }
    
    public void ThongTinThoc(String loc)
    {
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT "+loc+" FROM Thuoc WHERE MaThuoc = '"+MaThuocChon+"'");
                if(Luu.next())
                {
                    txtThongTinThuoc.setText(Luu.getString(loc));
                }
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            }
    }
    
    public void ThongTinBenh(String locbenh)
    {
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT "+locbenh+" FROM BenhTimMach WHERE MaBenh = '"+MaBenh+"'");
                if(Luu.next())
                {
                    txtThongTinThuoc.setText(Luu.getString(locbenh));
                }
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            }
    }
    public void ThuocChuaBenh_CuoiCung()
    {
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        while(DinhDangTable2.getRowCount()>0)
                DinhDangTable2.removeRow(0);
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT * FROM Thuoc where MaThuoc IN (SELECT DISTINCT MaThuoc FROM CauHoiTungThuoc WHERE XacNhan = 2 AND MaThuoc	\n" +
"NOT IN (SELECT MaThuoc FROM CauHoiTungThuoc WHERE XacNhan = 1 OR XacNhan = 0) \n" +
"AND MaThuoc IN (SELECT MaThuoc FROM DungThuoc WHERE MaBenh = '"+ MaBenh +"'))");
                while(Luu.next())
                {
                    Vector Point = new Vector();
                    Point.add(Luu.getString(1));
                    Point.add(Luu.getString(2));
                    DinhDangTable2.addRow(Point);
                }
                tbTenThuoc.setModel(DinhDangTable2);
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            }
    }
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jTabbedPane1 = new javax.swing.JTabbedPane();
        NguoiSuDung = new javax.swing.JPanel();
        ChonBenh = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tbTenBenh = new javax.swing.JTable();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tbTenThuoc = new javax.swing.JTable();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        HoiDap = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jScrollPane20 = new javax.swing.JScrollPane();
        txtCauHoi = new javax.swing.JTextPane();
        btCo = new javax.swing.JButton();
        btKhong = new javax.swing.JButton();
        btTaiSao = new javax.swing.JButton();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        txtGiaiThich = new javax.swing.JTextPane();
        HDSD = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        lbTenThuoc = new javax.swing.JLabel();
        btNguyenNhan = new javax.swing.JButton();
        btTrieuChung = new javax.swing.JButton();
        btLoiKhuyen = new javax.swing.JButton();
        btChiDinh = new javax.swing.JButton();
        btChongChiDinh = new javax.swing.JButton();
        btTacDungPhu = new javax.swing.JButton();
        btKetHopThuoc = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        lbLieuDung = new javax.swing.JTextPane();
        jScrollPane6 = new javax.swing.JScrollPane();
        txtThongTinThuoc = new javax.swing.JTextPane();
        ChuyenGia = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        txtKiemTra = new javax.swing.JPasswordField();
        btKiemTra = new javax.swing.JButton();
        tpChuyenGia = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        txtMaBenh = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtTenBenh = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jScrollPane7 = new javax.swing.JScrollPane();
        txtNguyenNhan = new javax.swing.JEditorPane();
        jLabel9 = new javax.swing.JLabel();
        jScrollPane8 = new javax.swing.JScrollPane();
        txtTrieuChung = new javax.swing.JEditorPane();
        jLabel8 = new javax.swing.JLabel();
        jScrollPane9 = new javax.swing.JScrollPane();
        txtLoiKhuyen = new javax.swing.JEditorPane();
        btThemBenh = new javax.swing.JButton();
        btSuaThongTin = new javax.swing.JButton();
        btThemMoi = new javax.swing.JButton();
        txtTimKiem = new javax.swing.JTextField();
        btTimKiem = new javax.swing.JButton();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane10 = new javax.swing.JScrollPane();
        tbCauHoi = new javax.swing.JTable();
        jScrollPane11 = new javax.swing.JScrollPane();
        tbTenBenh_Thuoc = new javax.swing.JTable();
        jLabel10 = new javax.swing.JLabel();
        jLabel17 = new javax.swing.JLabel();
        txtMaThuoc = new javax.swing.JTextField();
        txtTenThuoc = new javax.swing.JTextField();
        bttThemThuoc = new javax.swing.JButton();
        bttThemMoi = new javax.swing.JButton();
        bttThemBenhChuaTri = new javax.swing.JButton();
        bttThemCauHoi = new javax.swing.JButton();
        jButton5 = new javax.swing.JButton();
        bttSuaThongTin = new javax.swing.JButton();
        bttChongChiDinh = new javax.swing.JButton();
        bttTacDungPhu = new javax.swing.JButton();
        bttKetHopThuoc = new javax.swing.JButton();
        bttThanTrong = new javax.swing.JButton();
        bttChiDinh = new javax.swing.JButton();
        bttLieuDung = new javax.swing.JButton();
        jLayeredPane2 = new javax.swing.JLayeredPane();
        paChiDinh = new javax.swing.JPanel();
        jScrollPane12 = new javax.swing.JScrollPane();
        txtChiDinh = new javax.swing.JTextPane();
        paChongChiDinh = new javax.swing.JPanel();
        jScrollPane13 = new javax.swing.JScrollPane();
        txtChongChiDinh = new javax.swing.JTextPane();
        paLieuDung = new javax.swing.JPanel();
        jScrollPane14 = new javax.swing.JScrollPane();
        txtLieuDung = new javax.swing.JTextPane();
        paTacDungPhu = new javax.swing.JPanel();
        jScrollPane15 = new javax.swing.JScrollPane();
        txtTacDungPhu = new javax.swing.JTextPane();
        paThanTrong = new javax.swing.JPanel();
        jScrollPane16 = new javax.swing.JScrollPane();
        txtThanTrong = new javax.swing.JTextPane();
        paKetHopThuoc = new javax.swing.JPanel();
        jScrollPane17 = new javax.swing.JScrollPane();
        txtKetHopThuoc = new javax.swing.JTextPane();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane18 = new javax.swing.JScrollPane();
        tbbCauHoi = new javax.swing.JTable();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        txttMaBenh = new javax.swing.JTextField();
        txttMaCauHoi = new javax.swing.JTextField();
        jScrollPane19 = new javax.swing.JScrollPane();
        txttCauHoi = new javax.swing.JTextPane();
        jButton2 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder(new java.awt.Color(51, 51, 51), null));

        jTabbedPane1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTabbedPane1MouseClicked(evt);
            }
        });

        NguoiSuDung.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        ChonBenh.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Hãy Chọn Một Trong Các Bệnh Sau", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 12), new java.awt.Color(255, 0, 0))); // NOI18N

        tbTenBenh.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Mã Bệnh", "Tên Bệnh"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tbTenBenh.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbTenBenhMouseClicked(evt);
            }
        });
        jScrollPane1.setViewportView(tbTenBenh);

        javax.swing.GroupLayout ChonBenhLayout = new javax.swing.GroupLayout(ChonBenh);
        ChonBenh.setLayout(ChonBenhLayout);
        ChonBenhLayout.setHorizontalGroup(
            ChonBenhLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
        );
        ChonBenhLayout.setVerticalGroup(
            ChonBenhLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ChonBenhLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 166, Short.MAX_VALUE))
        );

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Thuốc Chữa Trị", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 12), new java.awt.Color(0, 102, 51))); // NOI18N

        tbTenThuoc.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Mã Thuốc", "Thuốc Chữa Trị"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tbTenThuoc.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbTenThuocMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(tbTenThuoc);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 203, Short.MAX_VALUE)
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 193, Short.MAX_VALUE))
        );

        HoiDap.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Hỏi --- Đáp", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 20), new java.awt.Color(0, 0, 255))); // NOI18N

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Hãy Trả Lời Một Số Câu Hỏi Sau:", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 12), new java.awt.Color(0, 102, 51))); // NOI18N

        txtCauHoi.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
        jScrollPane20.setViewportView(txtCauHoi);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane20))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane20, javax.swing.GroupLayout.DEFAULT_SIZE, 138, Short.MAX_VALUE))
        );

        btCo.setText("Có");
        btCo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCoActionPerformed(evt);
            }
        });

        btKhong.setText("Không");
        btKhong.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btKhongActionPerformed(evt);
            }
        });

        btTaiSao.setText("Tại Sao");
        btTaiSao.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                btTaiSaoMouseMoved(evt);
            }
        });
        btTaiSao.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btTaiSaoActionPerformed(evt);
            }
        });

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Giải Thích", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 12), new java.awt.Color(0, 102, 51))); // NOI18N

        txtGiaiThich.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        txtGiaiThich.setForeground(new java.awt.Color(0, 102, 51));
        jScrollPane4.setViewportView(txtGiaiThich);

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane4))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 132, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout HoiDapLayout = new javax.swing.GroupLayout(HoiDap);
        HoiDap.setLayout(HoiDapLayout);
        HoiDapLayout.setHorizontalGroup(
            HoiDapLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(HoiDapLayout.createSequentialGroup()
                .addGroup(HoiDapLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(HoiDapLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(HoiDapLayout.createSequentialGroup()
                        .addGap(173, 173, 173)
                        .addComponent(btCo, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(63, 63, 63)
                        .addComponent(btKhong, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(52, 52, 52)
                        .addComponent(btTaiSao, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 165, Short.MAX_VALUE))
                    .addGroup(HoiDapLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        HoiDapLayout.setVerticalGroup(
            HoiDapLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, HoiDapLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(HoiDapLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btKhong, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btCo, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btTaiSao, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18))
        );

        HoiDap.setBounds(0, 0, 775, 435);
        jLayeredPane1.add(HoiDap, javax.swing.JLayeredPane.DEFAULT_LAYER);

        HDSD.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Hướng Dẫn Sử Dụng Thuốc", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Times New Roman", 1, 20), new java.awt.Color(0, 0, 255))); // NOI18N
        HDSD.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() {
            public void mouseMoved(java.awt.event.MouseEvent evt) {
                HDSDMouseMoved(evt);
            }
        });

        jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel2.setText("Bệnh Nhân Nên Sử Dụng Thuốc:");

        jLabel3.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel3.setText("Liều Lượng & Cách Dùng:");

        lbTenThuoc.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        lbTenThuoc.setForeground(new java.awt.Color(0, 102, 51));
        lbTenThuoc.setText("Xin lỗi, hệ thống không có  thuốc thích hợp với bạn.");

        btNguyenNhan.setText("Nguyên Nhân Gây Bệnh");
        btNguyenNhan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btNguyenNhanActionPerformed(evt);
            }
        });

        btTrieuChung.setText("Triệu Chứng Của Bệnh");
        btTrieuChung.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btTrieuChungActionPerformed(evt);
            }
        });

        btLoiKhuyen.setText("Lời Khuyên");
        btLoiKhuyen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btLoiKhuyenActionPerformed(evt);
            }
        });

        btChiDinh.setText("Chỉ Định");
        btChiDinh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btChiDinhActionPerformed(evt);
            }
        });

        btChongChiDinh.setText("Chống Chỉ Định");
        btChongChiDinh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btChongChiDinhActionPerformed(evt);
            }
        });

        btTacDungPhu.setText("Tác Dụng Phụ");
        btTacDungPhu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btTacDungPhuActionPerformed(evt);
            }
        });

        btKetHopThuoc.setText("Kết Hợp Thuốc");
        btKetHopThuoc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btKetHopThuocActionPerformed(evt);
            }
        });

        lbLieuDung.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
        jScrollPane3.setViewportView(lbLieuDung);

        txtThongTinThuoc.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        txtThongTinThuoc.setForeground(new java.awt.Color(0, 102, 0));
        jScrollPane6.setViewportView(txtThongTinThuoc);

        javax.swing.GroupLayout HDSDLayout = new javax.swing.GroupLayout(HDSD);
        HDSD.setLayout(HDSDLayout);
        HDSDLayout.setHorizontalGroup(
            HDSDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, HDSDLayout.createSequentialGroup()
                .addContainerGap(52, Short.MAX_VALUE)
                .addGroup(HDSDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addGroup(HDSDLayout.createSequentialGroup()
                        .addComponent(btNguyenNhan, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(71, 71, 71)
                        .addComponent(btTrieuChung, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(66, 66, 66)
                        .addComponent(btLoiKhuyen, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(HDSDLayout.createSequentialGroup()
                        .addComponent(btChiDinh, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(btChongChiDinh, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(63, 63, 63)
                        .addComponent(btTacDungPhu, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(54, 54, 54)
                        .addComponent(btKetHopThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(49, 49, 49))
            .addGroup(HDSDLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(HDSDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane6)
                    .addGroup(HDSDLayout.createSequentialGroup()
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane3))
                    .addGroup(HDSDLayout.createSequentialGroup()
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(lbTenThuoc, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        HDSDLayout.setVerticalGroup(
            HDSDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(HDSDLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(HDSDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lbTenThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(HDSDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(HDSDLayout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(HDSDLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(10, 10, 10)
                .addGroup(HDSDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btNguyenNhan, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btTrieuChung, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btLoiKhuyen, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28)
                .addGroup(HDSDLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btChiDinh, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btChongChiDinh, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btTacDungPhu, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btKetHopThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane6, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE))
        );

        HDSD.setBounds(0, 0, 775, 435);
        jLayeredPane1.add(HDSD, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout NguoiSuDungLayout = new javax.swing.GroupLayout(NguoiSuDung);
        NguoiSuDung.setLayout(NguoiSuDungLayout);
        NguoiSuDungLayout.setHorizontalGroup(
            NguoiSuDungLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(NguoiSuDungLayout.createSequentialGroup()
                .addGroup(NguoiSuDungLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(ChonBenh, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLayeredPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 775, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        NguoiSuDungLayout.setVerticalGroup(
            NguoiSuDungLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(NguoiSuDungLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(NguoiSuDungLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(NguoiSuDungLayout.createSequentialGroup()
                        .addComponent(ChonBenh, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jLayeredPane1, javax.swing.GroupLayout.Alignment.TRAILING)))
        );

        jTabbedPane1.addTab("Người Sử Dụng", NguoiSuDung);

        ChuyenGia.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        ChuyenGia.setPreferredSize(new java.awt.Dimension(1000, 446));

        jLabel4.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel4.setText("Mời bạn nhập mã xác nhận để tiếp tục:");

        txtKiemTra.setText("chuyengia");

        btKiemTra.setText("Kiểm Tra");
        btKiemTra.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btKiemTraActionPerformed(evt);
            }
        });

        tpChuyenGia.setTabPlacement(javax.swing.JTabbedPane.RIGHT);
        tpChuyenGia.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tpChuyenGiaMouseClicked(evt);
            }
        });

        txtMaBenh.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N

        jLabel5.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel5.setText("Mã Bệnh:");

        jLabel6.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel6.setText("Tên Bệnh:");

        txtTenBenh.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N

        jLabel7.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel7.setText("Nguyên Nhân:");

        txtNguyenNhan.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jScrollPane7.setViewportView(txtNguyenNhan);

        jLabel9.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jLabel9.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel9.setText("Triệu Chứng:");

        txtTrieuChung.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jScrollPane8.setViewportView(txtTrieuChung);

        jLabel8.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jLabel8.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel8.setText("Lời Khuyên:");

        txtLoiKhuyen.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jScrollPane9.setViewportView(txtLoiKhuyen);

        btThemBenh.setText("Thêm Bệnh");
        btThemBenh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btThemBenhActionPerformed(evt);
            }
        });

        btSuaThongTin.setText("Sửa Thông Tin");
        btSuaThongTin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btSuaThongTinActionPerformed(evt);
            }
        });

        btThemMoi.setText("Thêm Mới");
        btThemMoi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btThemMoiActionPerformed(evt);
            }
        });

        txtTimKiem.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        txtTimKiem.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                txtTimKiemMouseClicked(evt);
            }
        });

        btTimKiem.setText("Tìm Kiếm");
        btTimKiem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btTimKiemActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(txtTenBenh, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(txtMaBenh, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(txtTimKiem, javax.swing.GroupLayout.PREFERRED_SIZE, 140, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btTimKiem)))
                .addContainerGap())
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(265, 265, 265)
                .addComponent(btThemBenh, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(43, 43, 43)
                .addComponent(btSuaThongTin, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(34, 34, 34)
                .addComponent(btThemMoi, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtMaBenh, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtTimKiem, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btTimKiem, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtTenBenh, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane8, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane9, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(27, 27, 27)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btThemBenh, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btSuaThongTin, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btThemMoi, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(27, Short.MAX_VALUE))
        );

        tpChuyenGia.addTab("Bệnh Tim", jPanel2);

        jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        tbCauHoi.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Mã Câu Hỏi", "Câu Hỏi"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tbCauHoi.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbCauHoiMouseClicked(evt);
            }
        });
        jScrollPane10.setViewportView(tbCauHoi);

        tbTenBenh_Thuoc.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Mã Bệnh", "Tên Bệnh"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tbTenBenh_Thuoc.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                tbTenBenh_ThuocMouseClicked(evt);
            }
        });
        jScrollPane11.setViewportView(tbTenBenh_Thuoc);

        jLabel10.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        jLabel10.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel10.setText("Mã Thuốc:");

        jLabel17.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        jLabel17.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel17.setText("Tên Thuốc:");

        txtMaThuoc.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N

        txtTenThuoc.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N

        bttThemThuoc.setText("Thêm Thuốc");
        bttThemThuoc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bttThemThuocActionPerformed(evt);
            }
        });

        bttThemMoi.setText("Thêm Mới");
        bttThemMoi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bttThemMoiActionPerformed(evt);
            }
        });

        bttThemBenhChuaTri.setText("Thêm Bệnh Chữa Trị");
        bttThemBenhChuaTri.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bttThemBenhChuaTriActionPerformed(evt);
            }
        });

        bttThemCauHoi.setText("Thêm Câu Hỏi");
        bttThemCauHoi.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bttThemCauHoiActionPerformed(evt);
            }
        });

        jButton5.setText("Tìm Kiếm");
        jButton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton5ActionPerformed(evt);
            }
        });

        bttSuaThongTin.setText("Sửa Thông Tin");
        bttSuaThongTin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bttSuaThongTinActionPerformed(evt);
            }
        });

        bttChongChiDinh.setText("Chống Chỉ Định");
        bttChongChiDinh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bttChongChiDinhActionPerformed(evt);
            }
        });

        bttTacDungPhu.setText("Tác Dụng Phụ");
        bttTacDungPhu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bttTacDungPhuActionPerformed(evt);
            }
        });

        bttKetHopThuoc.setText("Kết Hợp Thuốc");
        bttKetHopThuoc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bttKetHopThuocActionPerformed(evt);
            }
        });

        bttThanTrong.setText("Thận Trọng");
        bttThanTrong.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bttThanTrongActionPerformed(evt);
            }
        });

        bttChiDinh.setText("Chỉ Định");
        bttChiDinh.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bttChiDinhActionPerformed(evt);
            }
        });

        bttLieuDung.setText("Liều Dùng");
        bttLieuDung.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bttLieuDungActionPerformed(evt);
            }
        });

        txtChiDinh.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        jScrollPane12.setViewportView(txtChiDinh);

        javax.swing.GroupLayout paChiDinhLayout = new javax.swing.GroupLayout(paChiDinh);
        paChiDinh.setLayout(paChiDinhLayout);
        paChiDinhLayout.setHorizontalGroup(
            paChiDinhLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane12, javax.swing.GroupLayout.DEFAULT_SIZE, 590, Short.MAX_VALUE)
        );
        paChiDinhLayout.setVerticalGroup(
            paChiDinhLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane12, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
        );

        paChiDinh.setBounds(0, 0, 590, 130);
        jLayeredPane2.add(paChiDinh, javax.swing.JLayeredPane.DEFAULT_LAYER);

        txtChongChiDinh.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        jScrollPane13.setViewportView(txtChongChiDinh);

        javax.swing.GroupLayout paChongChiDinhLayout = new javax.swing.GroupLayout(paChongChiDinh);
        paChongChiDinh.setLayout(paChongChiDinhLayout);
        paChongChiDinhLayout.setHorizontalGroup(
            paChongChiDinhLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane13, javax.swing.GroupLayout.DEFAULT_SIZE, 590, Short.MAX_VALUE)
        );
        paChongChiDinhLayout.setVerticalGroup(
            paChongChiDinhLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane13, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
        );

        paChongChiDinh.setBounds(0, 0, 590, 130);
        jLayeredPane2.add(paChongChiDinh, javax.swing.JLayeredPane.DEFAULT_LAYER);

        txtLieuDung.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        jScrollPane14.setViewportView(txtLieuDung);

        javax.swing.GroupLayout paLieuDungLayout = new javax.swing.GroupLayout(paLieuDung);
        paLieuDung.setLayout(paLieuDungLayout);
        paLieuDungLayout.setHorizontalGroup(
            paLieuDungLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane14, javax.swing.GroupLayout.DEFAULT_SIZE, 590, Short.MAX_VALUE)
        );
        paLieuDungLayout.setVerticalGroup(
            paLieuDungLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane14, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
        );

        paLieuDung.setBounds(0, 0, 590, 130);
        jLayeredPane2.add(paLieuDung, javax.swing.JLayeredPane.DEFAULT_LAYER);

        txtTacDungPhu.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        jScrollPane15.setViewportView(txtTacDungPhu);

        javax.swing.GroupLayout paTacDungPhuLayout = new javax.swing.GroupLayout(paTacDungPhu);
        paTacDungPhu.setLayout(paTacDungPhuLayout);
        paTacDungPhuLayout.setHorizontalGroup(
            paTacDungPhuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane15, javax.swing.GroupLayout.DEFAULT_SIZE, 590, Short.MAX_VALUE)
        );
        paTacDungPhuLayout.setVerticalGroup(
            paTacDungPhuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane15, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
        );

        paTacDungPhu.setBounds(0, 0, 590, 130);
        jLayeredPane2.add(paTacDungPhu, javax.swing.JLayeredPane.DEFAULT_LAYER);

        txtThanTrong.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        jScrollPane16.setViewportView(txtThanTrong);

        javax.swing.GroupLayout paThanTrongLayout = new javax.swing.GroupLayout(paThanTrong);
        paThanTrong.setLayout(paThanTrongLayout);
        paThanTrongLayout.setHorizontalGroup(
            paThanTrongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane16, javax.swing.GroupLayout.DEFAULT_SIZE, 590, Short.MAX_VALUE)
        );
        paThanTrongLayout.setVerticalGroup(
            paThanTrongLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane16, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
        );

        paThanTrong.setBounds(0, 0, 590, 130);
        jLayeredPane2.add(paThanTrong, javax.swing.JLayeredPane.DEFAULT_LAYER);

        txtKetHopThuoc.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        jScrollPane17.setViewportView(txtKetHopThuoc);

        javax.swing.GroupLayout paKetHopThuocLayout = new javax.swing.GroupLayout(paKetHopThuoc);
        paKetHopThuoc.setLayout(paKetHopThuocLayout);
        paKetHopThuocLayout.setHorizontalGroup(
            paKetHopThuocLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane17, javax.swing.GroupLayout.DEFAULT_SIZE, 590, Short.MAX_VALUE)
        );
        paKetHopThuocLayout.setVerticalGroup(
            paKetHopThuocLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane17, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE)
        );

        paKetHopThuoc.setBounds(0, 0, 590, 130);
        jLayeredPane2.add(paKetHopThuoc, javax.swing.JLayeredPane.DEFAULT_LAYER);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(txtMaThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(47, 47, 47)
                .addComponent(jButton5, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(txtTenThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(150, 150, 150))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addComponent(jLayeredPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 590, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(bttThemThuoc)
                        .addGap(18, 18, 18)
                        .addComponent(bttSuaThongTin)
                        .addGap(18, 18, 18)
                        .addComponent(bttThemBenhChuaTri)
                        .addGap(18, 18, 18)
                        .addComponent(bttThemCauHoi)
                        .addGap(18, 18, 18)
                        .addComponent(bttThemMoi, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGap(18, 18, Short.MAX_VALUE)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(bttChiDinh, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bttLieuDung, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bttThanTrong, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(bttTacDungPhu, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bttChongChiDinh, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bttKetHopThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup()
                .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane10, javax.swing.GroupLayout.PREFERRED_SIZE, 682, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton5, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel17, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtMaThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(txtTenThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(bttChongChiDinh, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(bttChiDinh, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(bttTacDungPhu, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(bttLieuDung, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(bttKetHopThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(bttThanTrong, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLayeredPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(bttSuaThongTin, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bttThemThuoc, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bttThemBenhChuaTri, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bttThemCauHoi, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(bttThemMoi, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane10, javax.swing.GroupLayout.DEFAULT_SIZE, 108, Short.MAX_VALUE)
                    .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
                .addContainerGap())
        );

        tpChuyenGia.addTab("Thuốc Chữa Trị", jPanel3);

        tbbCauHoi.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Mã Câu Hỏi", "Câu Hỏi"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane18.setViewportView(tbbCauHoi);

        jLabel11.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jLabel11.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel11.setText("Mã Bệnh:");

        jLabel12.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel12.setText("Mã Câu Hỏi:");

        jLabel13.setFont(new java.awt.Font("Times New Roman", 1, 13)); // NOI18N
        jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel13.setText("Câu Hỏi:");

        txttMaBenh.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N

        txttMaCauHoi.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N

        txttCauHoi.setFont(new java.awt.Font("Times New Roman", 1, 15)); // NOI18N
        jScrollPane19.setViewportView(txttCauHoi);

        jButton2.setText("Thêm Câu Hỏi");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane18)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(txttMaCauHoi, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel4Layout.createSequentialGroup()
                                .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(txttMaBenh, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(jScrollPane19)))
                .addContainerGap())
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap(404, Short.MAX_VALUE)
                .addComponent(jButton2)
                .addGap(389, 389, 389))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txttMaBenh, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txttMaCauHoi, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel13, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane19, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jScrollPane18, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        tpChuyenGia.addTab("Câu Hỏi", jPanel4);

        javax.swing.GroupLayout ChuyenGiaLayout = new javax.swing.GroupLayout(ChuyenGia);
        ChuyenGia.setLayout(ChuyenGiaLayout);
        ChuyenGiaLayout.setHorizontalGroup(
            ChuyenGiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ChuyenGiaLayout.createSequentialGroup()
                .addGroup(ChuyenGiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(ChuyenGiaLayout.createSequentialGroup()
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 266, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(txtKiemTra, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(48, 48, 48)
                        .addComponent(btKiemTra, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(tpChuyenGia))
                .addContainerGap())
        );
        ChuyenGiaLayout.setVerticalGroup(
            ChuyenGiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(ChuyenGiaLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(ChuyenGiaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtKiemTra, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btKiemTra, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tpChuyenGia)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Chuyên Gia", ChuyenGia);

        jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(153, 0, 153));
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("HỆ CHUYÊN GIA: TƯ VẤN SỬ DỤNG THUỐC CHO CÁC BỆNH TIM MẠCH");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 677, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(158, 158, 158))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 474, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void tbTenBenhMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbTenBenhMouseClicked
        HoiDap.setVisible(true);
        HDSD.setVisible(false);
        int row = tbTenBenh.getSelectedRow();
        String Khoa = (tbTenBenh.getModel().getValueAt(row, 0).toString());
        SelectTenThuoc(Khoa);
        MaBenh = Khoa;
        
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
        {
         PreparedStatement DoiTuongThucThi = DoiTuongKetNoi.prepareStatement("UPDATE CauHoiTungThuoc SET XacNhan = '0';");
         DoiTuongThucThi.executeUpdate();
         DoiTuongKetNoi.close();
        }
        catch (SQLException ex) 
        {
            ex.printStackTrace();
            JOptionPane.showMessageDialog(null, "Không Kết Nối Được Với Cơ Sở Dữ Liệu",  "Thông Báo",JOptionPane.ERROR_MESSAGE);
        }
        txtGiaiThich.setText("");
        txtThongTinThuoc.setText("");
        CauHoi();
    }//GEN-LAST:event_tbTenBenhMouseClicked
    
    public void CauHoi()
    {
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu1 = DoiTuongThucThi.executeQuery("SELECT MaCauHoi, CauHoi FROM DanhSachCauHoi WHERE MaCauHoi IN (SELECT MaCauHoi FROM CauHoiTungThuoc WHERE XacNhan = 0 \n" +
"AND MaThuoc NOT IN (SELECT MaThuoc FROM CauHoiTungThuoc WHERE XacNhan = 1)) AND MaBenh = '"+ MaBenh +"' AND MaCauHoi NOT IN\n" +
"(SELECT MaCauHoi FROM CauHoiTungThuoc WHERE XacNhan = 2) ORDER BY MaCauHoi ASC;");
                Nhay = new JdbcRowSetImpl(Luu1);
                try
                {
                    Luu1.first();
                    MaCauHoi = Luu1.getString("MaCauHoi");
                    txtCauHoi.setText(Luu1.getString("CauHoi"));
                }
                catch(Exception e) 
                {
                    e.printStackTrace();
                }
            }
            catch (SQLException ex) 
            {
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
            }
    }
    public void Next_CauHoi()
    {
        if (Nhay != null) {
            try 
            {
                MaCauHoi = Nhay.getString("MaCauHoi");
                txtCauHoi.setText(Nhay.getString("CauHoi"));
            } catch(SQLException e) {
                System.out.println("Khong lay duoc du lieu tu Rowset");
                HoiDap.setVisible(false);
                HDSD.setVisible(true);
            }
        }
    }
    
    public void DieuKien_Hien()
    {
         try 
        {
           String thu = txtCauHoi.getText(0, 55);
           if("Bệnh nhân có đang sử dụng một trong các loại thuốc sau:".equals(thu))
               btTaiSao.setEnabled(true);
        } 
        catch(Exception e) 
        {
            e.printStackTrace();
        }    
    }
    
    private void jTabbedPane1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTabbedPane1MouseClicked
        HoiDap.setVisible(true);
        HDSD.setVisible(false);
        SelectTenBenh();
        SelectTenBenh_Thuoc();
        SelectDanhSachCauHoi();
    }//GEN-LAST:event_jTabbedPane1MouseClicked

    private void btCoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCoActionPerformed
        btTaiSao.setEnabled(false);
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
        {
         PreparedStatement DoiTuongThucThi = DoiTuongKetNoi.prepareStatement("UPDATE CauHoiTungThuoc SET XacNhan = '1' WHERE MaCauHoi = '"+ MaCauHoi +"' /*AND MaThuoc IN\n" +
"(SELECT MaThuoc FROM DungThuoc WHERE MaBenh = '"+ MaBenh +"')*/");
         DoiTuongThucThi.executeUpdate();
         DoiTuongKetNoi.close();
        }
        catch (SQLException ex) 
        {
            ex.printStackTrace();
            JOptionPane.showMessageDialog(null, "Không Kết Nối Được Với Cơ Sở Dữ Liệu",  "Thông Báo",JOptionPane.ERROR_MESSAGE);
        }
        ThuocChuaBenh();
        
        CauHoi();
        try 
        {
             Nhay.first();
             ThuocUuTien();
        } 
        catch(Exception e) 
        {
            e.printStackTrace();
            HoiDap.setVisible(false);
            HDSD.setVisible(true);
            ThuocChuaBenh_CuoiCung();
            ThuocUuTien();
        }
        Next_CauHoi();
    }//GEN-LAST:event_btCoActionPerformed

    private void btKhongActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btKhongActionPerformed
        btTaiSao.setEnabled(false);
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
        {
         PreparedStatement DoiTuongThucThi = DoiTuongKetNoi.prepareStatement("UPDATE CauHoiTungThuoc SET XacNhan = '2' WHERE MaCauHoi = '"+ MaCauHoi +"' AND MaThuoc IN\n" +
"(SELECT MaThuoc FROM DungThuoc WHERE MaBenh = '"+ MaBenh +"')");
         DoiTuongThucThi.executeUpdate();
         DoiTuongKetNoi.close();
        }
        catch (SQLException ex) 
        {
            ex.printStackTrace();
            JOptionPane.showMessageDialog(null, "Không Kết Nối Được Với Cơ Sở Dữ Liệu",  "Thông Báo",JOptionPane.ERROR_MESSAGE);
        }
        ThuocChuaBenh();
        
        //CauHoi();
        try 
        {
            if (!Nhay.isLast())
                Nhay.next();
            else
            {
                ThuocChuaBenh_CuoiCung();
                HoiDap.setVisible(false);
                HDSD.setVisible(true);
                ThuocUuTien();
            }
        } 
        catch(Exception e) 
        {
            e.printStackTrace();
        }    
        Next_CauHoi();
    }//GEN-LAST:event_btKhongActionPerformed

    private void btTaiSaoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btTaiSaoActionPerformed
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT KetHopThuoc FROM Thuoc WHERE MaThuoc IN \n" +
"(SELECT MaThuoc FROM CauHoiTungThuoc WHERE MaCauHoi = '"+ MaCauHoi +"');");
                if(Luu.next())
                {
                    txtGiaiThich.setText(Luu.getString("KetHopThuoc"));
                }
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            }
    }//GEN-LAST:event_btTaiSaoActionPerformed

    private void btTaiSaoMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btTaiSaoMouseMoved
       DieuKien_Hien();
    }//GEN-LAST:event_btTaiSaoMouseMoved

    private void HDSDMouseMoved(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_HDSDMouseMoved
        
    }//GEN-LAST:event_HDSDMouseMoved

    private void btChiDinhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btChiDinhActionPerformed
        ThongTinThoc("ChiDinh");
    }//GEN-LAST:event_btChiDinhActionPerformed

    private void btChongChiDinhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btChongChiDinhActionPerformed
        ThongTinThoc("ChongChiDinh");
    }//GEN-LAST:event_btChongChiDinhActionPerformed

    private void btTacDungPhuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btTacDungPhuActionPerformed
        ThongTinThoc("TacDungPhu");
    }//GEN-LAST:event_btTacDungPhuActionPerformed

    private void btKetHopThuocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btKetHopThuocActionPerformed
        ThongTinThoc("KetHopThuoc");
    }//GEN-LAST:event_btKetHopThuocActionPerformed

    private void btNguyenNhanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btNguyenNhanActionPerformed
        ThongTinBenh("NguyenNhan");
    }//GEN-LAST:event_btNguyenNhanActionPerformed

    private void btTrieuChungActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btTrieuChungActionPerformed
        ThongTinBenh("TrieuChung");
    }//GEN-LAST:event_btTrieuChungActionPerformed

    private void btLoiKhuyenActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btLoiKhuyenActionPerformed
        ThongTinBenh("LoiKhuyen");
    }//GEN-LAST:event_btLoiKhuyenActionPerformed

    private void tbTenThuocMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbTenThuocMouseClicked
        int row = tbTenThuoc.getSelectedRow();
        MaThuocChon = tbTenThuoc.getValueAt(row, 0).toString();
        lbTenThuoc.setText(tbTenThuoc.getValueAt(row, 1).toString());
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT LieuDung FROM Thuoc WHERE MaThuoc = '"+MaThuocChon+"'");
                if(Luu.next())
                {
                    lbLieuDung.setText(Luu.getString("LieuDung"));
                }
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            }
    }//GEN-LAST:event_tbTenThuocMouseClicked

    private void btKiemTraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btKiemTraActionPerformed
        if("chuyengia".equals(String.copyValueOf(txtKiemTra.getPassword())))
        {
            tpChuyenGia.setVisible(true);
            txtKiemTra.setText("");
        }
        else
        {
            txtKiemTra.setText("");
            JOptionPane.showMessageDialog(null, "Mật mã xác nhận sai! hãy thử lại.", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
            txtKiemTra.requestFocus();
        }
//        SelectTenBenh_Thuoc();
//        SelectDanhSachCauHoi();
//        SelectDanhSachCauHoi2();
    }//GEN-LAST:event_btKiemTraActionPerformed

    private void btTimKiemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btTimKiemActionPerformed
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
         try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT * FROM BenhTimMach WHERE MaBenh = '"+txtTimKiem.getText()+"';");
                
                if(Luu.next())
                {
                    txtMaBenh.setText(Luu.getString("MaBenh"));
                    txtTenBenh.setText(Luu.getString("TenBenh"));
                    txtNguyenNhan.setText(Luu.getString("NguyenNhan"));
                    txtTrieuChung.setText(Luu.getString("TrieuChung"));
                    txtLoiKhuyen.setText(Luu.getString("LoiKhuyen"));
                }
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
            }
    }//GEN-LAST:event_btTimKiemActionPerformed

    private void btThemBenhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btThemBenhActionPerformed
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                PreparedStatement DoiTuongThucThi = DoiTuongKetNoi.prepareStatement("INSERT INTO BenhTimMach VALUES (?, ?, ?, ?, ?);");
                    DoiTuongThucThi.setString(1, txtMaBenh.getText());
                    DoiTuongThucThi.setString(2, txtTenBenh.getText());
                    DoiTuongThucThi.setString(3, txtNguyenNhan.getText());
                    DoiTuongThucThi.setString(4, txtTrieuChung.getText());
                    DoiTuongThucThi.setString(5, txtLoiKhuyen.getText());
                    DoiTuongThucThi.executeUpdate();
                JOptionPane.showMessageDialog(null, "Bạn đã thêm bệnh "+txtTenBenh.getText()+" vào cơ sở dữ liệu.",  "Thông Báo",JOptionPane.CLOSED_OPTION);
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(null, "Không Kết Nối Được Với Cơ Sở Dữ Liệu",  "Thông Báo",JOptionPane.ERROR_MESSAGE);
            } 
        txtMaBenh.setText("");
        txtTenBenh.setText("");
        txtNguyenNhan.setText("");
        txtTrieuChung.setText("");
        txtLoiKhuyen.setText("");
    }//GEN-LAST:event_btThemBenhActionPerformed

    private void btSuaThongTinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSuaThongTinActionPerformed
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                PreparedStatement DoiTuongThucThi = DoiTuongKetNoi.prepareStatement("UPDATE BenhTimMach SET TenBenh = ?, NguyenNhan = ?, TrieuChung = ?, LoiKhuyen = ? WHERE MaBenh = ?;");
                    DoiTuongThucThi.setString(1, txtTenBenh.getText());
                    DoiTuongThucThi.setString(2, txtNguyenNhan.getText());
                    DoiTuongThucThi.setString(3, txtTrieuChung.getText());
                    DoiTuongThucThi.setString(4, txtLoiKhuyen.getText());
                    DoiTuongThucThi.setString(5, txtMaBenh.getText());
                    DoiTuongThucThi.executeUpdate();
                JOptionPane.showMessageDialog(null, "Bạn sửa thông tin bệnh "+txtTenBenh.getText()+" vào cơ sở dữ liệu.",  "Thông Báo",JOptionPane.CLOSED_OPTION);
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(null, "Không Kết Nối Được Với Cơ Sở Dữ Liệu",  "Thông Báo",JOptionPane.ERROR_MESSAGE);
            } 
        txtMaBenh.setText("");
        txtTenBenh.setText("");
        txtNguyenNhan.setText("");
        txtTrieuChung.setText("");
        txtLoiKhuyen.setText("");
    }//GEN-LAST:event_btSuaThongTinActionPerformed

    private void btThemMoiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btThemMoiActionPerformed
        txtMaBenh.setText("");
        txtTenBenh.setText("");
        txtNguyenNhan.setText("");
        txtTrieuChung.setText("");
        txtLoiKhuyen.setText("");
    }//GEN-LAST:event_btThemMoiActionPerformed

    private void txtTimKiemMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtTimKiemMouseClicked
        txtTimKiem.setText("");
    }//GEN-LAST:event_txtTimKiemMouseClicked

    private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
         try
            {
                Statement DoiTuongThucThi = DoiTuongKetNoi.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
                        ResultSet.CONCUR_UPDATABLE);
                ResultSet Luu = DoiTuongThucThi.executeQuery("SELECT * FROM Thuoc WHERE MaThuoc = '"+txtMaThuoc.getText()+"';");
                
                if(Luu.next())
                {
                    txtTenThuoc.setText(Luu.getString("TenThuoc"));
                    txtChiDinh.setText(Luu.getString("ChiDinh"));
                    txtChongChiDinh.setText(Luu.getString("ChongChiDinh"));
                    txtLieuDung.setText(Luu.getString("LieuDung"));
                    txtTacDungPhu.setText(Luu.getString("TacDungPhu"));
                    txtThanTrong.setText(Luu.getString("ThanTrong"));
                    txtKetHopThuoc.setText(Luu.getString("KetHopThuoc"));
                }
                Luu.close();
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                JOptionPane.showMessageDialog(null, "Không thể kết nối với cơ sở dữ liệu của bạn", "Thông Báo Lỗi", JOptionPane.ERROR_MESSAGE);
                Logger.getLogger(GiaoDienChinh.class.getName()).log(Level.SEVERE, null, ex);
            }
        paChiDinh.setVisible(true);
        paChongChiDinh.setVisible(false);
        paLieuDung.setVisible(false);
        paTacDungPhu.setVisible(false);
        paThanTrong.setVisible(false);
        paKetHopThuoc.setVisible(false);
    }//GEN-LAST:event_jButton5ActionPerformed

    private void bttChiDinhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttChiDinhActionPerformed
        paChiDinh.setVisible(true);
        paChongChiDinh.setVisible(false);
        paLieuDung.setVisible(false);
        paTacDungPhu.setVisible(false);
        paThanTrong.setVisible(false);
        paKetHopThuoc.setVisible(false);
        txtChiDinh.requestFocus();
    }//GEN-LAST:event_bttChiDinhActionPerformed

    private void bttChongChiDinhActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttChongChiDinhActionPerformed
        paChiDinh.setVisible(false);
        paChongChiDinh.setVisible(true);
        paLieuDung.setVisible(false);
        paTacDungPhu.setVisible(false);
        paThanTrong.setVisible(false);
        paKetHopThuoc.setVisible(false);
        txtChongChiDinh.requestFocus();
    }//GEN-LAST:event_bttChongChiDinhActionPerformed

    private void bttLieuDungActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttLieuDungActionPerformed
        paChiDinh.setVisible(false);
        paChongChiDinh.setVisible(false);
        paLieuDung.setVisible(true);
        paTacDungPhu.setVisible(false);
        paThanTrong.setVisible(false);
        paKetHopThuoc.setVisible(false);
        txtLieuDung.requestFocus();
    }//GEN-LAST:event_bttLieuDungActionPerformed

    private void bttTacDungPhuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttTacDungPhuActionPerformed
        paChiDinh.setVisible(false);
        paChongChiDinh.setVisible(false);
        paLieuDung.setVisible(false);
        paTacDungPhu.setVisible(true);
        paThanTrong.setVisible(false);
        paKetHopThuoc.setVisible(false);
        txtTacDungPhu.requestFocus();
    }//GEN-LAST:event_bttTacDungPhuActionPerformed

    private void bttThanTrongActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttThanTrongActionPerformed
        paChiDinh.setVisible(false);
        paChongChiDinh.setVisible(false);
        paLieuDung.setVisible(false);
        paTacDungPhu.setVisible(false);
        paThanTrong.setVisible(true);
        paKetHopThuoc.setVisible(false);
        txtThanTrong.requestFocus();
    }//GEN-LAST:event_bttThanTrongActionPerformed

    private void bttKetHopThuocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttKetHopThuocActionPerformed
        paChiDinh.setVisible(false);
        paChongChiDinh.setVisible(false);
        paLieuDung.setVisible(false);
        paTacDungPhu.setVisible(false);
        paThanTrong.setVisible(false);
        paKetHopThuoc.setVisible(true);
        txtKetHopThuoc.requestFocus();
    }//GEN-LAST:event_bttKetHopThuocActionPerformed

    private void bttThemThuocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttThemThuocActionPerformed
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                PreparedStatement DoiTuongThucThi = DoiTuongKetNoi.prepareStatement("INSERT INTO Thuoc VALUES (?, ?, ?, ?, ?, ?, ?, ?);");
                    DoiTuongThucThi.setString(1, txtMaThuoc.getText());
                    DoiTuongThucThi.setString(2, txtTenThuoc.getText());
                    DoiTuongThucThi.setString(3, txtChiDinh.getText());
                    DoiTuongThucThi.setString(4, txtLieuDung.getText());
                    DoiTuongThucThi.setString(5, txtChongChiDinh.getText());
                    DoiTuongThucThi.setString(6, txtTacDungPhu.getText());
                    DoiTuongThucThi.setString(7, txtThanTrong.getText());
                    DoiTuongThucThi.setString(8, txtKetHopThuoc.getText());
                    DoiTuongThucThi.executeUpdate();
                JOptionPane.showMessageDialog(null, "Bạn đã thêm thuốc "+txtTenThuoc.getText()+" vào cơ sở dữ liệu. Hãy chọn bệnh thuốc có thể chữa trị và những câu hỏi cần thiết khi sử dụng thuốc",  "Thông Báo",JOptionPane.CLOSED_OPTION);
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(null, "Không Kết Nối Được Với Cơ Sở Dữ Liệu",  "Thông Báo",JOptionPane.ERROR_MESSAGE);
            } 
    }//GEN-LAST:event_bttThemThuocActionPerformed

    private void bttSuaThongTinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttSuaThongTinActionPerformed
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                PreparedStatement DoiTuongThucThi = DoiTuongKetNoi.prepareStatement("UPDATE Thuoc SET TenThuoc = ?, ChiDinh = ?, LieuDung = ?, ChongChiDinh = ?, TacDungPhu = ?, ThanTrong = ?, KetHopThuoc = ? WHERE MaThuoc = ?;");
                    DoiTuongThucThi.setString(1, txtTenThuoc.getText());
                    DoiTuongThucThi.setString(2, txtChiDinh.getText());
                    DoiTuongThucThi.setString(3, txtLieuDung.getText());
                    DoiTuongThucThi.setString(4, txtChongChiDinh.getText());
                    DoiTuongThucThi.setString(5, txtTacDungPhu.getText());
                    DoiTuongThucThi.setString(6, txtThanTrong.getText());
                    DoiTuongThucThi.setString(7, txtKetHopThuoc.getText());
                    DoiTuongThucThi.setString(8, txtMaThuoc.getText());
                    DoiTuongThucThi.executeUpdate();
                JOptionPane.showMessageDialog(null, "Bạn sửa thông tin thuốc "+txtTenThuoc.getText()+" vào cơ sở dữ liệu.",  "Thông Báo",JOptionPane.CLOSED_OPTION);
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(null, "Không Kết Nối Được Với Cơ Sở Dữ Liệu",  "Thông Báo",JOptionPane.ERROR_MESSAGE);
            } 
    }//GEN-LAST:event_bttSuaThongTinActionPerformed

    private void tbTenBenh_ThuocMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbTenBenh_ThuocMouseClicked
        int row = tbTenBenh_Thuoc.getSelectedRow();
        MaBenhChuaTri = tbTenBenh_Thuoc.getValueAt(row, 0).toString();
        TenBenhChuaTri = tbTenBenh_Thuoc.getValueAt(row, 1).toString();
    }//GEN-LAST:event_tbTenBenh_ThuocMouseClicked

    private void tbCauHoiMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tbCauHoiMouseClicked
        int row = tbCauHoi.getSelectedRow();
        MaCauHoiCanThiet = tbCauHoi.getValueAt(row, 0).toString();
        CauHoiCanThiet = tbCauHoi.getValueAt(row, 1).toString();
    }//GEN-LAST:event_tbCauHoiMouseClicked

    private void bttThemBenhChuaTriActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttThemBenhChuaTriActionPerformed
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                PreparedStatement DoiTuongThucThi = DoiTuongKetNoi.prepareStatement("EXEC Dung_Thuoc ?, ?;");
                    DoiTuongThucThi.setString(1, MaBenhChuaTri);
                    DoiTuongThucThi.setString(2, txtMaThuoc.getText());
                    DoiTuongThucThi.executeUpdate();
                JOptionPane.showMessageDialog(null, "Thuốc "+txtTenThuoc.getText()+" được dùng để trị bệnh "+TenBenhChuaTri+"",  "Thông Báo",JOptionPane.CLOSED_OPTION);
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(null, "Không Kết Nối Được Với Cơ Sở Dữ Liệu",  "Thông Báo",JOptionPane.ERROR_MESSAGE);
            } 
    }//GEN-LAST:event_bttThemBenhChuaTriActionPerformed

    private void bttThemCauHoiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttThemCauHoiActionPerformed
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                PreparedStatement DoiTuongThucThi = DoiTuongKetNoi.prepareStatement("EXEC CauHoi_TungTHuoc ?, ?;");
                    DoiTuongThucThi.setString(2, txtMaThuoc.getText());
                    DoiTuongThucThi.setString(1, MaCauHoiCanThiet);
                    DoiTuongThucThi.executeUpdate();
                    
//                PreparedStatement DoiTuongThucThi1 = DoiTuongKetNoi.prepareStatement("INSERT INTO DanhSachCauHoi VALUES (?, ?, ?);");
//                    DoiTuongThucThi1.setString(1, MaBenhChuaTri);
//                    DoiTuongThucThi1.setString(2, MaCauHoiCanThiet);
//                    DoiTuongThucThi1.setString(3, CauHoiCanThiet);
//                    DoiTuongThucThi1.executeUpdate();
                PreparedStatement DoiTuongThucThi1 = DoiTuongKetNoi.prepareStatement("exec sp_2_thamso ?, ?, ?;");
                    DoiTuongThucThi1.setString(1, MaBenhChuaTri);
                    DoiTuongThucThi1.setString(2, MaCauHoiCanThiet);
                    DoiTuongThucThi1.setString(3, CauHoiCanThiet);
                    DoiTuongThucThi1.executeUpdate();
                JOptionPane.showMessageDialog(null, "Khi sử dụng thuốc "+txtTenThuoc.getText()+" sẽ hỏi câu: "+CauHoiCanThiet+"",  "Thông Báo",JOptionPane.CLOSED_OPTION);
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(null, "Không Kết Nối Được Với Cơ Sở Dữ Liệu",  "Thông Báo",JOptionPane.ERROR_MESSAGE);
            } 
    }//GEN-LAST:event_bttThemCauHoiActionPerformed

    private void bttThemMoiActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bttThemMoiActionPerformed
        txtMaThuoc.setText("");
        txtTenThuoc.setText("");
        txtChiDinh.setText("");
        txtLieuDung.setText("");
        txtChongChiDinh.setText("");
        txtTacDungPhu.setText("");
        txtThanTrong.setText("");
        txtKetHopThuoc.setText("");
    }//GEN-LAST:event_bttThemMoiActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        KetNoi = new KetNoiCSDL();
        DoiTuongKetNoi = KetNoi.KetNoiCSDL();
        try
            {
                PreparedStatement DoiTuongThucThi = DoiTuongKetNoi.prepareStatement("INSERT INTO DanhSachCauHoi VALUES (?, ?, ?);");
                    DoiTuongThucThi.setString(1, txttMaBenh.getText());
                    DoiTuongThucThi.setString(2, txttMaCauHoi.getText());
                    DoiTuongThucThi.setString(3, txttCauHoi.getText());
                    DoiTuongThucThi.executeUpdate();
                JOptionPane.showMessageDialog(null, "Bạn đã thêm câu hỏi: "+txttCauHoi.getText()+" vào cơ sở dữ liệu.",  "Thông Báo",JOptionPane.CLOSED_OPTION);
                DoiTuongKetNoi.close();
            }
            catch (SQLException ex) 
            {
                ex.printStackTrace();
                JOptionPane.showMessageDialog(null, "Không Kết Nối Được Với Cơ Sở Dữ Liệu",  "Thông Báo",JOptionPane.ERROR_MESSAGE);
            } 
        txttMaBenh.setText("");
        txttMaCauHoi.setText("");
        txttCauHoi.setText("");
        SelectDanhSachCauHoi2();
    }//GEN-LAST:event_jButton2ActionPerformed

    private void tpChuyenGiaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_tpChuyenGiaMouseClicked
        SelectTenBenh_Thuoc();
        SelectDanhSachCauHoi();
        SelectDanhSachCauHoi2();
    }//GEN-LAST:event_tpChuyenGiaMouseClicked
    
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new GiaoDienChinh().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel ChonBenh;
    private javax.swing.JPanel ChuyenGia;
    private javax.swing.JPanel HDSD;
    private javax.swing.JPanel HoiDap;
    private javax.swing.JPanel NguoiSuDung;
    private javax.swing.JButton btChiDinh;
    private javax.swing.JButton btChongChiDinh;
    private javax.swing.JButton btCo;
    private javax.swing.JButton btKetHopThuoc;
    private javax.swing.JButton btKhong;
    private javax.swing.JButton btKiemTra;
    private javax.swing.JButton btLoiKhuyen;
    private javax.swing.JButton btNguyenNhan;
    private javax.swing.JButton btSuaThongTin;
    private javax.swing.JButton btTacDungPhu;
    private javax.swing.JButton btTaiSao;
    private javax.swing.JButton btThemBenh;
    private javax.swing.JButton btThemMoi;
    private javax.swing.JButton btTimKiem;
    private javax.swing.JButton btTrieuChung;
    private javax.swing.JButton bttChiDinh;
    private javax.swing.JButton bttChongChiDinh;
    private javax.swing.JButton bttKetHopThuoc;
    private javax.swing.JButton bttLieuDung;
    private javax.swing.JButton bttSuaThongTin;
    private javax.swing.JButton bttTacDungPhu;
    private javax.swing.JButton bttThanTrong;
    private javax.swing.JButton bttThemBenhChuaTri;
    private javax.swing.JButton bttThemCauHoi;
    private javax.swing.JButton bttThemMoi;
    private javax.swing.JButton bttThemThuoc;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton5;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JLayeredPane jLayeredPane2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane10;
    private javax.swing.JScrollPane jScrollPane11;
    private javax.swing.JScrollPane jScrollPane12;
    private javax.swing.JScrollPane jScrollPane13;
    private javax.swing.JScrollPane jScrollPane14;
    private javax.swing.JScrollPane jScrollPane15;
    private javax.swing.JScrollPane jScrollPane16;
    private javax.swing.JScrollPane jScrollPane17;
    private javax.swing.JScrollPane jScrollPane18;
    private javax.swing.JScrollPane jScrollPane19;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane20;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JScrollPane jScrollPane9;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTextPane lbLieuDung;
    private javax.swing.JLabel lbTenThuoc;
    private javax.swing.JPanel paChiDinh;
    private javax.swing.JPanel paChongChiDinh;
    private javax.swing.JPanel paKetHopThuoc;
    private javax.swing.JPanel paLieuDung;
    private javax.swing.JPanel paTacDungPhu;
    private javax.swing.JPanel paThanTrong;
    private javax.swing.JTable tbCauHoi;
    private javax.swing.JTable tbTenBenh;
    private javax.swing.JTable tbTenBenh_Thuoc;
    private javax.swing.JTable tbTenThuoc;
    private javax.swing.JTable tbbCauHoi;
    private javax.swing.JTabbedPane tpChuyenGia;
    private javax.swing.JTextPane txtCauHoi;
    private javax.swing.JTextPane txtChiDinh;
    private javax.swing.JTextPane txtChongChiDinh;
    private javax.swing.JTextPane txtGiaiThich;
    private javax.swing.JTextPane txtKetHopThuoc;
    private javax.swing.JPasswordField txtKiemTra;
    private javax.swing.JTextPane txtLieuDung;
    private javax.swing.JEditorPane txtLoiKhuyen;
    private javax.swing.JTextField txtMaBenh;
    private javax.swing.JTextField txtMaThuoc;
    private javax.swing.JEditorPane txtNguyenNhan;
    private javax.swing.JTextPane txtTacDungPhu;
    private javax.swing.JTextField txtTenBenh;
    private javax.swing.JTextField txtTenThuoc;
    private javax.swing.JTextPane txtThanTrong;
    private javax.swing.JTextPane txtThongTinThuoc;
    private javax.swing.JTextField txtTimKiem;
    private javax.swing.JEditorPane txtTrieuChung;
    private javax.swing.JTextPane txttCauHoi;
    private javax.swing.JTextField txttMaBenh;
    private javax.swing.JTextField txttMaCauHoi;
    // End of variables declaration//GEN-END:variables
}
